package com.ramos.kuaixiao.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.PopupWindow;

import com.ramos.kuaixiao.R;

public class SelectPicPopupWindow
        extends PopupWindow {
    private Button cancelBtn;
    private View mMenuView;
    private Button pickPhotoBtn;
    private Button takePhotoBtn;
    private Button showPhotoBtn;
    private Button deletePhotoBtn;
    @SuppressLint({"InflateParams"})
    public SelectPicPopupWindow(Context paramContext, OnClickListener paramOnClickListener) {
        super(paramContext);
        this.mMenuView = ((LayoutInflater) paramContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_popupwindow_pic, null);
        this.takePhotoBtn = ((Button) this.mMenuView.findViewById(R.id.takePhotoBtn));
        this.pickPhotoBtn = ((Button) this.mMenuView.findViewById(R.id.pickPhotoBtn));
        this.cancelBtn = ((Button) this.mMenuView.findViewById(R.id.cancelBtn));
        this.cancelBtn.setOnClickListener(paramOnClickListener);
        this.pickPhotoBtn.setOnClickListener(paramOnClickListener);
        this.takePhotoBtn.setOnClickListener(paramOnClickListener);
        //this.showPhotoBtn.setOnClickListener(paramOnClickListener);
        //this.deletePhotoBtn.setOnClickListener(paramOnClickListener);
        setContentView(this.mMenuView);
        setWidth(-1);
        setHeight(-2);
        setFocusable(true);
        setAnimationStyle(R.style.PopupAnimation);
        setBackgroundDrawable(new ColorDrawable(Integer.MIN_VALUE));
        this.mMenuView.setOnTouchListener(new OnTouchListener() {
            @SuppressLint({"ClickableViewAccessibility"})
            public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent) {
                int i = SelectPicPopupWindow.this.mMenuView.findViewById(R.id.pop_layout).getTop();
                int j = (int) paramAnonymousMotionEvent.getY();
                if ((paramAnonymousMotionEvent.getAction() == 1) && (j < i)) {
                    SelectPicPopupWindow.this.dismiss();
                }
                return true;
            }
        });
    }
}